package com.example.sql.handle.impl;

import java.sql.ResultSet;
import java.util.Date;

import com.example.sql.handle.ResultSetHandle;
import com.example.sql.model.User;

public class UserHandle implements ResultSetHandle<User> {

    @Override
    public User handle(ResultSet resultSet) {
        User user = null;
        try {
            String id = resultSet.getString("id");
        String username = resultSet.getString("username");
        String email = resultSet.getString("email");
        Date birthdate = resultSet.getDate("birthdate");
        user = new User();
        user.setId(id);
        user.setUsername(username);
        user.setEmail(email);
        user.setBirthdate(birthdate);
        
        } catch (Exception e) {
            e.printStackTrace();
        }
        return user;
    }

}
